import treeTools from "@/common/treeTools";

export default {
  state: {
    footerHeight: '20px',
    // 是否全屏
    isCollapse: false,
    // 默认首页
    defaultPath: 'personal',
    // 菜单区域的主题
    sideTheme: 'theme-dark',
  },
  getters: {
    homePage: (state, getters, rootState) => {
      let path = state.defaultPath
      treeTools.iterator(rootState.permission.menus, node => {
        if(node.meta && node.meta.code === state.defaultPath){
          path = node.path
        }
      })
      return '/home/' + path
    }
  },
  mutations: {
    setIsCollapse: (state, isCollapse) => {
      state.isCollapse = isCollapse
    },
    setDefaultPath: (state, path) => {
      state.defaultPath = path
    }
  },
  actions: {},
  namespaced: true
}
